package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	swaggerfiles "github.com/swaggo/files"
	ginSwagger "github.com/swaggo/gin-swagger"
	"log"
	"mishop/models"
	"mishop/routers"
)
import "github.com/spf13/viper"

func init() {
	viper.AddConfigPath("config")
	viper.SetConfigName("config")
	viper.SetConfigType("json")
	if err := viper.ReadInConfig(); err != nil {
		log.Fatal(err)
	}

}
func main() {
	r := gin.Default()
	port := viper.GetInt("port")
	log.Println(port)

	models.InitModels()
	routers.InitRouters(r)
	//routers.Group()
	r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))
	r.Run(fmt.Sprintf(":%d", port))
}
